package com.raymond.queue;

import com.raymond.queue.utils.FileQueueBuilder;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 队列管理
 *
 * @author :  raymond
 * @version :  V1.0
 * @date :  2021-07-14 14:21
 */
public class QueueManager {

    private static final Map<String, FileQueue<byte[]>> FILE_QUEUE_MAP = new ConcurrentHashMap<>();

    private static final Map<String, Production<byte[]>> PRODUCTION_MAP = new ConcurrentHashMap<>();

    public static void put(FileQueue<byte[]> fileQueue) {
        FILE_QUEUE_MAP.put(fileQueue.getTopic(), fileQueue);
        PRODUCTION_MAP.put(fileQueue.getTopic(), fileQueue.getProduction());
    }

    public static FileQueue<byte[]> getFileQueue(String topic) {
        return FILE_QUEUE_MAP.get(topic);
    }

    public static Production getProduction(String topic) {
        return PRODUCTION_MAP.get(topic);
    }

}
